@extends('Console.layout')

@section('breadcrumb')
    @parent
    <li class="breadcrumb-item active" aria-current="page">用户列表</li>
@endsection


@section('content-header-menu')
    <a href="{{route('users.console.view')}}" class="btn  btn-secondary">添加用户</a>
@endsection
@section('content')
    <div class="card">
        <div class="card-header">
            <form class="" method="GET" action="{{ url()->current() }}">
                <div class="form-inline">
                    <form-input-text  data-name="keyword"  data-value="{{$search['keyword'] ?? ''}}" data-placeholder="登录名，昵称，邮箱，电话"></form-input-text>

                    <form-input-select data-name="role"  v-bind:data-options=@json($role_options)></form-input-select>

                    <form-input-select data-name="status"  v-bind:data-options=@json($status_options)></form-input-select>


                    <button type="submit" class="btn btn-outline-primary ">搜索</button>
                </div>
            </form>
        </div>
        <!-- /.box-header -->
        <div class="card-body ">
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th><input class="entity-check-all checkbox-inline" data-check-items=".entity-check-item" type="checkbox">登录名</th>
                    <th>昵称</th>
                    <th>电话</th>
                    <th>邮箱</th>
                    <th>用户组</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($models as $model)
                    <tr>
                        <td>
                            <input class="entity-check-item checkbox-inline" type="checkbox" value="{{$model->_id}}" data-tips="{{$model->account}}">
                            {{$model->account}}</td>
                        <td>{{$model->name}}</td>
                        <td>{{$model->mobile}}</td>
                        <td>{{$model->email}}</td>
                        <td>
                            @foreach ($model->roles as $role)
                                {{$role->name}}
                            @endforeach
                        </td>
                        <td>@if ($model->status == 1)启用@else禁用@endif</td>
                        <td>
                            <a href="{{route('users.console.view',['_id'=>$model->_id])}}">详情</a>
                            <a href="javascript:void(0);" class="modal-open-delete" data-modal-id="managerUsers"
                               data-id="{{$model->_id}}" data-tips="{{$model->name}}" data-modal-title="删除用户">删除</a>
                        </td>
                    </tr>
                @endforeach

                </tbody>
                <tfoot>

                </tfoot>
            </table>
        </div>
        <!-- /.box-body -->
        <div class="card-footer">
            <div class="pull-left">
                <button class="modal-open-delete-multi btn btn-outline-danger" data-modal-id="managerUsers" data-check-item="entity-check-item" data-modal-title="删除用户">删除</button>
            </div>
            <div class="pull-right">
                {{$pager}}
            </div>

        </div>
    </div>
    <!-- /.box -->

@endsection

@section('modals')
    @parent
    @component('shared.modals..delete', ['identifier' => 'managerUsers','action'=>route('users.console.delete')])
    @endcomponent
@endsection
